from page.base_page import BasePage
from selenium.webdriver.common.by import By

class HomePage(BasePage):
    # 元素定位器
    WELCOME_MESSAGE = (By.CSS_SELECTOR, '.welcome-message')
    LOGOUT_BUTTON = (By.ID, 'logout-button')
    
    def get_welcome_message(self):
        return self.get_text(self.WELCOME_MESSAGE)
    
    def click_logout_button(self):
        self.click(self.LOGOUT_BUTTON)
    
    def is_logged_in(self):
        return self.is_element_displayed(self.LOGOUT_BUTTON)  